<?php $this->pageTitle= UserModule::t('View User').' - '.Yii::app()->name;?>

<?php $this->beginWidget('webroot.widgets.iButtonBar');?>

<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>UserModule::t('Create User'),
    'type'=>'success',
    'icon'=>'plus-sign white',
    'url'=> array('create'),
));?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>UserModule::t('Update User'),
    'type'=>'primary',
    'icon'=>'edit white',
    'url'=> array('update', 'id'=>$model->id),
));?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>UserModule::t('Cancel'),
    'type'=>'primary',
    'icon'=>'remove-sign white',
    'url'=> array('admin'),
));?>
<?php $this->widget('bootstrap.widgets.TbButton', array(
    'label'=>UserModule::t('Delete User'),
    'type'=>'danger',
    'icon'=>'remove white',
    'url'=> '#',
	'htmlOptions'=>array('submit'=>array('delete','id'=>$model->id),'confirm'=>UserModule::t('Are you sure to delete this item?'))
));?>
<?php $this->endWidget();?>

<?php $this->beginWidget('webroot.widgets.iPortlet', array('title'=>UserModule::t('View User')." \"{$model->username}\""));?>
<?php
 
	$attributes = array(
		'id',
		'username',
	);
	
	$profileFields=ProfileField::model()->forOwner()->sort()->findAll();
	if ($profileFields) {
		foreach($profileFields as $field) {
			array_push($attributes,array(
					'label' => UserModule::t($field->title),
					'name' => $field->varname,
					'type'=>'raw',
					'value' => (($field->widgetView($model->profile))?$field->widgetView($model->profile):(($field->range)?Profile::range($field->range,$model->profile->getAttribute($field->varname)):$model->profile->getAttribute($field->varname))),
				));
		}
	}
	
	array_push($attributes,
		'password',
		'email',
		array(
			'name'=>'office_id',
			'value'=>$model->office->name
		),
		'activkey',
		'create_at',
		'lastvisit_at',
		array(
			'name' => 'superuser',
			'value' => User::itemAlias("AdminStatus",$model->superuser),
		),
		array(
			'name' => 'status',
			'value' => User::itemAlias("UserStatus",$model->status),
		)
	);
	
	$this->widget('bootstrap.widgets.TbDetailView', array(
		'data'=>$model,
		'attributes'=>$attributes,
	));
	
?>
<?php $this->endWidget();?>